using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace CXDB
{
	#region Tables Struct
	public partial struct Tables
	{
		
		public static string CxApply = @"CX_Apply";
        
		public static string CxChengxin = @"CX_Chengxin";
        
		public static string CxCompanyPingJium = @"CX_Company_PingJia";
        
		public static string CxCompanySysElectric = @"CX_Company_Sys_Electric";
        
		public static string CxCompanySysTrade = @"CX_Company_Sys_Trade";
        
		public static string CxCompanyBase = @"CX_CompanyBase";
        
		public static string CxCompanyTradeModifyLog = @"CX_CompanyTradeModifyLog";
        
		public static string CxFile = @"CX_File";
        
		public static string CxProvider = @"CX_Provider";
        
		public static string CxRemark = @"CX_Remark";
        
		public static string CxStaffHr = @"CX_Staff_HR";
        
		public static string CxStaffSafty = @"CX_Staff_Safty";
        
		public static string CxSysChengXin = @"CX_SYS_ChengXin";
        
		public static string CxSysDept = @"CX_SYS_Dept";
        
		public static string CxUserBase = @"CX_UserBase";
        
		public static string CxUserLogin = @"CX_UserLogin";
        
	}
	#endregion
    #region Schemas
    public partial class Schemas {
		
		public static TableSchema.Table CxApply{
            get { return DataService.GetSchema("CX_Apply","CXDB"); }
		}
        
		public static TableSchema.Table CxChengxin{
            get { return DataService.GetSchema("CX_Chengxin","CXDB"); }
		}
        
		public static TableSchema.Table CxCompanyPingJium{
            get { return DataService.GetSchema("CX_Company_PingJia","CXDB"); }
		}
        
		public static TableSchema.Table CxCompanySysElectric{
            get { return DataService.GetSchema("CX_Company_Sys_Electric","CXDB"); }
		}
        
		public static TableSchema.Table CxCompanySysTrade{
            get { return DataService.GetSchema("CX_Company_Sys_Trade","CXDB"); }
		}
        
		public static TableSchema.Table CxCompanyBase{
            get { return DataService.GetSchema("CX_CompanyBase","CXDB"); }
		}
        
		public static TableSchema.Table CxCompanyTradeModifyLog{
            get { return DataService.GetSchema("CX_CompanyTradeModifyLog","CXDB"); }
		}
        
		public static TableSchema.Table CxFile{
            get { return DataService.GetSchema("CX_File","CXDB"); }
		}
        
		public static TableSchema.Table CxProvider{
            get { return DataService.GetSchema("CX_Provider","CXDB"); }
		}
        
		public static TableSchema.Table CxRemark{
            get { return DataService.GetSchema("CX_Remark","CXDB"); }
		}
        
		public static TableSchema.Table CxStaffHr{
            get { return DataService.GetSchema("CX_Staff_HR","CXDB"); }
		}
        
		public static TableSchema.Table CxStaffSafty{
            get { return DataService.GetSchema("CX_Staff_Safty","CXDB"); }
		}
        
		public static TableSchema.Table CxSysChengXin{
            get { return DataService.GetSchema("CX_SYS_ChengXin","CXDB"); }
		}
        
		public static TableSchema.Table CxSysDept{
            get { return DataService.GetSchema("CX_SYS_Dept","CXDB"); }
		}
        
		public static TableSchema.Table CxUserBase{
            get { return DataService.GetSchema("CX_UserBase","CXDB"); }
		}
        
		public static TableSchema.Table CxUserLogin{
            get { return DataService.GetSchema("CX_UserLogin","CXDB"); }
		}
        
	
    }
    #endregion
    #region View Struct
    public partial struct Views 
    {
		
		public static string Sysconstraint = @"sysconstraints";
        
		public static string Syssegment = @"syssegments";
        
		public static string VwApplyCompany = @"vw_apply_company";
        
		public static string VwApplyExportCompany = @"vw_apply_export_company";
        
		public static string VwApplyExportHr = @"vw_apply_export_hr";
        
		public static string VwApplyExportSafty = @"vw_apply_export_safty";
        
		public static string VwApplyHr = @"vw_apply_hr";
        
		public static string VwApplyProvider = @"vw_apply_provider";
        
		public static string VwApplySafty = @"vw_apply_safty";
        
		public static string VwApplyScore = @"vw_apply_scores";
        
		public static string VwChengxindetail = @"vw_chengxindetail";
        
		public static string VwCompanyPingjium = @"vw_company_pingjia";
        
		public static string VwCompanyScoresGroupby = @"vw_company_scores_groupby";
        
		public static string VwCompanybase = @"vw_companybase";
        
		public static string VwProviderRep = @"vw_provider_rep";
        
		public static string VwStaffHrStep1 = @"vw_Staff_HR_Step1";
        
		public static string VwStaffSaftyStep1 = @"vw_Staff_Safty_Step1";
        
		public static string VwUserBase = @"vw_userBase";
        
    }
    #endregion
    
    #region Query Factories
	public static partial class DB
	{
        public static DataProvider _provider = DataService.Providers["CXDB"];
        static ISubSonicRepository _repository;
        public static ISubSonicRepository Repository {
            get {
                if (_repository == null)
                    return new SubSonicRepository(_provider);
                return _repository; 
            }
            set { _repository = value; }
        }
	
        public static Select SelectAllColumnsFrom<T>() where T : RecordBase<T>, new()
	    {
            return Repository.SelectAllColumnsFrom<T>();
            
	    }
	    public static Select Select()
	    {
            return Repository.Select();
	    }
	    
		public static Select Select(params string[] columns)
		{
            return Repository.Select(columns);
        }
	    
		public static Select Select(params Aggregate[] aggregates)
		{
            return Repository.Select(aggregates);
        }
   
	    public static Update Update<T>() where T : RecordBase<T>, new()
	    {
            return Repository.Update<T>();
	    }
     
	    
	    public static Insert Insert()
	    {
            return Repository.Insert();
	    }
	    
	    public static Delete Delete()
	    {
            
            return Repository.Delete();
	    }
	    
	    public static InlineQuery Query()
	    {
            
            return Repository.Query();
	    }
	    	    
	    
	}
    #endregion
    
}
#region Databases
public partial struct Databases 
{
	
	public static string CXDB = @"CXDB";
    
}
#endregion